home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / MachineExceptions.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  5.3 KB  |  202 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MachineExceptions.p
  3.  
  4.      Contains:    Processor Exception Handling Interfaces .
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT MachineExceptions;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __MACHINEEXCEPTIONS__}
  30. {$SETC __MACHINEEXCEPTIONS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC MachineExceptionsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.     
  46. TYPE
  47.     AreaID = KernelID;
  48.  
  49. { Machine Dependent types for PowerPC: }
  50.     MachineInformationPowerPC = RECORD
  51.         CTR:                    UnsignedWide;
  52.         LR:                        UnsignedWide;
  53.         PC:                        UnsignedWide;
  54.         CR:                        LONGINT;
  55.         XER:                    LONGINT;
  56.         MSR:                    LONGINT;
  57.     END;
  58.  
  59.     RegisterInformationPowerPC = RECORD
  60.         R0:                        UnsignedWide;
  61.         R1:                        UnsignedWide;
  62.         R2:                        UnsignedWide;
  63.         R3:                        UnsignedWide;
  64.         R4:                        UnsignedWide;
  65.         R5:                        UnsignedWide;
  66.         R6:                        UnsignedWide;
  67.         R7:                        UnsignedWide;
  68.         R8:                        UnsignedWide;
  69.         R9:                        UnsignedWide;
  70.         R10:                    UnsignedWide;
  71.         R11:                    UnsignedWide;
  72.         R12:                    UnsignedWide;
  73.         R13:                    UnsignedWide;
  74.         R14:                    UnsignedWide;
  75.         R15:                    UnsignedWide;
  76.         R16:                    UnsignedWide;
  77.         R17:                    UnsignedWide;
  78.         R18:                    UnsignedWide;
  79.         R19:                    UnsignedWide;
  80.         R20:                    UnsignedWide;
  81.         R21:                    UnsignedWide;
  82.         R22:                    UnsignedWide;
  83.         R23:                    UnsignedWide;
  84.         R24:                    UnsignedWide;
  85.         R25:                    UnsignedWide;
  86.         R26:                    UnsignedWide;
  87.         R27:                    UnsignedWide;
  88.         R28:                    UnsignedWide;
  89.         R29:                    UnsignedWide;
  90.         R30:                    UnsignedWide;
  91.         R31:                    UnsignedWide;
  92.     END;
  93.  
  94.     FPUInformationPowerPC = RECORD
  95.         Registers:                ARRAY [0..31] OF UnsignedWide;
  96.         FPSCR:                    LONGINT;
  97.         Reserved:                LONGINT;
  98.     END;
  99.  
  100.  
  101. CONST
  102.     kWriteReference                = 0;
  103.     kReadReference                = 1;
  104.     kFetchReference                = 2;
  105.     writeReference                = kWriteReference;                { Obsolete name}
  106.     readReference                = kReadReference;                { Obsolete name}
  107.     fetchReference                = kFetchReference;                { Obsolete name}
  108.  
  109.     
  110. TYPE
  111.     MemoryReferenceKind = LONGINT;
  112.  
  113.     MemoryExceptionInformation = RECORD
  114.         theArea:                AreaID;
  115.         theAddress:                LogicalAddress;
  116.         theError:                OSStatus;
  117.         theReference:            MemoryReferenceKind;
  118.     END;
  119.  
  120.  
  121. CONST
  122.     kUnknownException            = 0;
  123.     kIllegalInstructionException = 1;
  124.     kTrapException                = 2;
  125.     kAccessException            = 3;
  126.     kUnmappedMemoryException    = 4;
  127.     kExcludedMemoryException    = 5;
  128.     kReadOnlyMemoryException    = 6;
  129.     kUnresolvablePageFaultException = 7;
  130.     kPrivilegeViolationException = 8;
  131.     kTraceException                = 9;
  132.     kInstructionBreakpointException = 10;
  133.     kDataBreakpointException    = 11;
  134.     kIntegerException            = 12;
  135.     kFloatingPointException        = 13;
  136.     kStackOverflowException        = 14;
  137.     kTerminationException        = 15;
  138.     unknownException            = kUnknownException;            { Obsolete name}
  139.     illegalInstructionException    = kIllegalInstructionException;    { Obsolete name}
  140.     trapException                = kTrapException;                { Obsolete name}
  141.     accessException                = kAccessException;                { Obsolete name}
  142.     unmappedMemoryException        = kUnmappedMemoryException;        { Obsolete name}
  143.     excludedMemoryException        = kExcludedMemoryException;        { Obsolete name}
  144.     readOnlyMemoryException        = kReadOnlyMemoryException;        { Obsolete name}
  145.     unresolvablePageFaultException = kUnresolvablePageFaultException; { Obsolete name}
  146.     privilegeViolationException    = kPrivilegeViolationException;    { Obsolete name}
  147.     traceException                = kTraceException;                { Obsolete name}
  148.     instructionBreakpointException = kInstructionBreakpointException; { Obsolete name}
  149.     dataBreakpointException        = kDataBreakpointException;        { Obsolete name}
  150.     integerException            = kIntegerException;            { Obsolete name}
  151.     floatingPointException        = kFloatingPointException;        { Obsolete name}
  152.     stackOverflowException        = kStackOverflowException;        { Obsolete name}
  153.     terminationException        = kTerminationException;        { Obsolete name}
  154.  
  155.     
  156. TYPE
  157.     ExceptionKind = LONGINT;
  158.  
  159.     ExceptionInfo = RECORD
  160.         CASE INTEGER OF
  161.         0: (
  162.             memoryInfo:                    ^MemoryExceptionInformation;
  163.            );
  164.     END;
  165.  
  166.     ExceptionInformationPowerPC = RECORD
  167.         theKind:                ExceptionKind;
  168.         machineState:            ^MachineInformationPowerPC;
  169.         registerImage:            ^RegisterInformationPowerPC;
  170.         FPUImage:                ^FPUInformationPowerPC;
  171.         info:                    ExceptionInfo;
  172.     END;
  173.  
  174. {$IFC GENERATINGPOWERPC }
  175.     ExceptionInformation = ExceptionInformationPowerPC;
  176.  
  177.     MachineInformation = MachineInformationPowerPC;
  178.  
  179.     RegisterInformation = RegisterInformationPowerPC;
  180.  
  181.     FPUInformation = FPUInformationPowerPC;
  182.  
  183. {$ENDC}
  184. { Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  185.             It must be a native function pointer with NO routine descriptor. }
  186.     ExceptionHandler = ProcPtr;  { FUNCTION (VAR theException: ExceptionInformationPowerPC): OSStatus; }
  187.  
  188. { Routine for installing per-process exception handlers }
  189.  
  190. FUNCTION InstallExceptionHandler(theHandler: ExceptionHandler): ExceptionHandler;
  191.  
  192. {$ALIGN RESET}
  193. {$POP}
  194.  
  195. {$SETC UsingIncludes := MachineExceptionsIncludes}
  196.  
  197. {$ENDC} {__MACHINEEXCEPTIONS__}
  198.  
  199. {$IFC NOT UsingIncludes}
  200.  END.
  201. {$ENDC}
  202.